Xbasic

MathUtil::DecimalCompare Method

Syntax

.Compare as N (one as C, two as C)

Arguments

oneCharacter

The first value to compare, defined as a character string.

twoCharacter

The second value to compare defined as a character string.

Returns

resultNumeric

Returns a value of -1, 0, or 1 depending on the result of the comparison as described below:

Result
Meaning
-1

Second parameter two is greater than the first parameter one.

0

The two numbers are equal.

1

First parameter one is greater than the second parameter two.

Description

Compares two values. Returns 0 if they are equal, 1 if the second value is greater, -1 if the first value is greater.

Example

? MathUtil::Decimal::compare("12","13")
= -1

? MathUtil::Decimal::compare("13","12")
= 1

? MathUtil::Decimal::compare("1","1")
= 0